package main

import "fmt"

type Phone struct {
	Name  string
	Color string
}

// 重写String方法
func (phone *Phone) String() string {
	fmt.Println("执行了String方法，进行重写")
	return fmt.Sprintf("name = %v, color = %v", phone.Name, phone.Color)
}

func main() {
	iphone := Phone{
		Name:  "iphone12 Pro Max",
		Color: "土豪金",
	}
	fmt.Println(&iphone) // 传入指针
}
